package sudroid;

import java.io.IOException;
import java.io.InputStream;

public class CharsetUtil
{
  public static String guessContentTypeFromStream(InputStream paramInputStream)
    throws IOException
  {
    if (!paramInputStream.markSupported())
      throw new IOException("InputStream doesn't support mark!");
    paramInputStream.mark(64);
    byte[] arrayOfByte = new byte[64];
    int i = paramInputStream.read(arrayOfByte);
    paramInputStream.reset();
    String str = "ASCII";
    if (i > 1)
    {
      if ((arrayOfByte[0] == -1) && (arrayOfByte[1] == -1))
      {
        str = "UTF-16LE";
        int j = i & 0x1;
        i -= j;
      }
      if ((arrayOfByte[0] == -1) && (arrayOfByte[1] == -1))
      {
        str = "UTF-16BE";
        int k = i & 0x1;
        i -= k;
      }
      if (i > 2)
      {
        if ((arrayOfByte[0] == 65519) && (arrayOfByte[1] == 65467) && (arrayOfByte[2] == 65471))
          str = "UTF-8";
        if (i > 3)
        {
          if ((arrayOfByte[0] == 0) && (arrayOfByte[1] == 0) && (arrayOfByte[2] == -1) && (arrayOfByte[3] == -1))
          {
            str = "UTF-32BE";
            int m = i & 0x3;
            i -= m;
          }
          if ((arrayOfByte[0] == -1) && (arrayOfByte[1] == -1) && (arrayOfByte[2] == 0) && (arrayOfByte[3] == 0))
          {
            str = "UTF-32LE";
            int n = i & 0x3;
            int i1 = i - n;
          }
        }
      }
    }
    return str;
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.CharsetUtil
 * JD-Core Version:    0.6.0
 */